package com.yuyou.train.user.vo.req;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;

import com.yuyou.train.util.bean.ResBoolSimpleInfo;
import com.yuyou.train.util.enums.CommEnums;

public class ReqUserHwCorrect {

	private String userHwId;
	
	/**
	 * 点评内容
	 */
	private String content;
	
	
	/**
	 * 评分
	 */
	private Integer score;
	
	
	/**
	 * 老师附件url
	 */
	private String teachAttachUrl;
	
	/**
	 * 老师附件名字
	 */
	private String teachAttachName;
	
	private String fileSourceName;
	
	/**
	 * 23项评分表
	 */
	List<ReqUserHwCorrectConfig> configList;
	
	
	private List<String> goodList;
	
	private List<String> badList;

	
	
	
	public String getFileSourceName() {
		return fileSourceName;
	}

	public void setFileSourceName(String fileSourceName) {
		this.fileSourceName = fileSourceName;
	}

	public String getUserHwId() {
		return userHwId;
	}

	public void setUserHwId(String userHwId) {
		this.userHwId = userHwId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Integer getScore() {
		return score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public String getTeachAttachUrl() {
		return teachAttachUrl;
	}

	public void setTeachAttachUrl(String teachAttachUrl) {
		this.teachAttachUrl = teachAttachUrl;
	}

	public String getTeachAttachName() {
		return teachAttachName;
	}

	public void setTeachAttachName(String teachAttachName) {
		this.teachAttachName = teachAttachName;
	}

	public List<ReqUserHwCorrectConfig> getConfigList() {
		return configList;
	}

	public void setConfigList(List<ReqUserHwCorrectConfig> configList) {
		this.configList = configList;
	}

	public List<String> getGoodList() {
		return goodList;
	}

	public void setGoodList(List<String> goodList) {
		this.goodList = goodList;
	}

	public List<String> getBadList() {
		return badList;
	}

	public void setBadList(List<String> badList) {
		this.badList = badList;
	}


	public static ResBoolSimpleInfo<String> validate(ReqUserHwCorrect req,String resourceType,boolean isUserTeacher ){
		ResBoolSimpleInfo<String> res=new ResBoolSimpleInfo<String>();
		if(StringUtils.isEmpty(req.getUserHwId())){
			res.setSuccess(false);
			res.setMessage("userHwId不能为空");
			return res;
		}		
		if(resourceType.equals(CommEnums.resourceType.hwJustCommit.getValue())){
			if(StringUtils.isEmpty(req.getContent())){
				res.setSuccess(false);
				res.setMessage("content不能为空");
				return res;
			}
			if(req.getScore()==null || req.getScore()<0){
				res.setSuccess(false);
				res.setMessage("score必须大于0");
				return res;
			}
		}else if(resourceType.equals(CommEnums.resourceType.hwNeedComment.getValue())&&isUserTeacher){
			if(CollectionUtils.isEmpty(req.getConfigList())||CollectionUtils.isEmpty(req.getGoodList())
					||CollectionUtils.isEmpty(req.getBadList())
					){
				res.setSuccess(false);
				res.setMessage("list不能为空");
				return res;
			}	
		}		
		return ResBoolSimpleInfo.getSuccessInfo();
	}
	
	
	

}
